import { defHttp } from '/@/utils/http/axios';
import {
  WebsiteActivityModel,
  WebsiteActivityTableRecordModel,
} from '../model/websiteActivityModel';
import { ErrorMessageMode } from '/#/axios';

enum Api {
  WEBSITEACTIVITY_PAGE = '/jxxhWebsite/websiteActivity/getActivityVosPage',
  GET_WEBSITE_ACTIVITY_SCHEDULE_LIST = '/jxxhWebsite/websiteActivity/getWebsiteActivityScheduleList/',
  WEBSITE_ACTIVITY_EXPERT_LIST = '/jxxhWebsite/websiteActivity/getWebsiteActivityExpertList/',
  GET_WEBSITEACTIVITYVO_BY_ID = '/jxxhWebsite/websiteActivity/',
  WEBSITEACTIVITYVO_SAVE = '/jxxhWebsite/websiteActivity/save',
  WEBSITEACTIVITYVO_UPDATE = '/jxxhWebsite/websiteActivity/updateById',
  WEBSITEACTIVITYVO_REMOVE = '/jxxhWebsite/websiteActivity/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteActivityListApi = (params: Object) =>
  defHttp.get<WebsiteActivityTableRecordModel>(
    { url: Api.WEBSITEACTIVITY_PAGE, params },
    { errorMessageMode: 'message' },
  );

export const websiteActivityScheduleListApi = (id) =>
  defHttp.get<WebsiteActivityTableRecordModel>(
    { url: Api.GET_WEBSITE_ACTIVITY_SCHEDULE_LIST + id },
    { errorMessageMode: 'message' },
  );

export const websiteActivityExpertListApi = (id) =>
  defHttp.get<WebsiteActivityTableRecordModel>(
    { url: Api.WEBSITE_ACTIVITY_EXPERT_LIST + id },
    { errorMessageMode: 'message' },
  );

export const getWebsiteActivityVoByIdApi = (id) =>
  defHttp.get<WebsiteActivityModel>(
    { url: Api.GET_WEBSITEACTIVITYVO_BY_ID + id },
    { errorMessageMode: 'message' },
  );

export function websiteActivitySaveApi(
  params: WebsiteActivityModel,
  mode: ErrorMessageMode = 'modal',
) {
  return defHttp.post<WebsiteActivityModel>(
    {
      url: Api.WEBSITEACTIVITYVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteActivityUpdateApi(
  params: WebsiteActivityModel,
  mode: ErrorMessageMode = 'modal',
) {
  return defHttp.put<WebsiteActivityModel>(
    {
      url: Api.WEBSITEACTIVITYVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteActivityModel>(
    { url: Api.WEBSITEACTIVITYVO_REMOVE + id },
    { errorMessageMode: 'message' },
  );
